package net.jueb.springStudy.logicA.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//开启refresh机制， 需要给加载变量的类上面加载@RefreshScope注解，其它代码可不做任何改变，那么在客户端执行/refresh的时候就会更新此类下面的变量值
@RefreshScope
@RestController
public class TestController {

	@Value("${testStr}")
	String testStr;
	
	@Value("${server.port}")
	int port;
	
	@RequestMapping("/test")
	public String test() {
		return testStr+" from serverPort:"+port;
	}
}
